<template>
  <div class="box">
    <h4>孙组件标题</h4>
    <div>content1:{{content1}}</div>
    <div>content2.name:{{content2?.name}}</div>
    
  </div>
</template>

<script  lang="ts">
export default {
  name: 'GrandChild',
}
</script>
<script  lang="ts" setup>
// import { inject } from 'vue'
// // const content1 = inject('abc')
// // const content2 = inject('content2')
// const text = inject('text')
// // inject的尖括号中写的就是当前接收的数据类型
// const content1 = inject<string>('abc')
// const content2 = inject<{
//   name: string
// }>('content2')

import { inject } from 'vue';

// const content1=inject('abc')
// const content2=inject('content2')
const content1=inject<string>('abc')
const content2=inject<{
  name:string
}>('content2')
</script>
